<!DOCTYPE html>
<html lang="zh">
<html xmlns:th="http://www.thymeleaf.org">
<head th:replace="common/header :: header(~{::title},~{::link},~{})">
    <title>编辑周计划</title>
    <link rel="icon" th:href="@{/assets/img/lcxm.ico}" type="image/ico">
</head>
<body class="body">
<!--导航-->
<div th:replace="common/nav :: nav(true)"></div>

<div class="container">

    <div class="row">
        <div style="margin-top: 20px;"></div>
        <div class="row">

            <form class="form-horizontal validate" role="form" method="post" th:action="@{/project/save}"
                  onsubmit="return checkForm(this);">

                <!-- 操作信息提示的地方 -->
                <div th:if="${remind}" class="alert alert-${ remind.level  }"
                     th:classappend="'alert-' + ${remind.level}">
                    <button data-dismiss="alert" class="close" type="button">
                        <i class="glyphicon glyphicon-remove"></i>
                    </button>
                    <span th:remove="tag" th:utext="${ remind.message }"></span>
                </div>

                <input type="hidden" id="planId" th:value="${entity?.id}"/>
                <input type="hidden" id="userId" th:value="${entity?.userId}"/>
                <div class="col-sm-12 col-sm-offset-0">
                    <table class="table table-striped table-condensed table-bordered stable">
                        <caption>周计划基本信息</caption>
                        <tbody>
                        <tr class="success">
                            <th>小组</th>
                            <th>用户</th>
                            <th>周次</th>
                            <th>时间</th>
                            <th>状态</th>
                            <th>实际使用工时</th>

                        </tr>
                        <tr class="text-center text-danger">
                            <td th:text="${entity?.groupName}">groupName</td>
                            <td th:text="${entity?.userName}">userName</td>
                            <td th:text="${entity?.weekNumber}">weekNumber</td>
                            <td>
                                 <span class="text-success"
                                       th:text="${#dates.format(cur?.weekStart, 'MM-dd')}"></span>—
                                <span class="text-success"
                                      th:text="${#dates.format(cur?.weekEnd, 'MM-dd')}"></span>
                            </td>
                            <td th:text="${entity?.submissionStatus?.text}">status</td>
                            <td th:text="${entity?.actualEffort}">actualEffort</td>
                        </tr>

                    </table>

                </div>
                <div class="col-sm-12 col-sm-offset-0">
                    <div class="action-bar">
                        <a class="btn btn-sm btn-success" id="addPlanDetail" onclick="addRowDetail();" title="新增计划">
                            <i class="glyphicon glyphicon-plus"></i> 新增计划
                        </a>
                    </div>

                    <table class="table table-striped  table-hover table-bordered stable">
                        <caption>周计划列表
                        </caption>
                        <colgroup>
                            <col style="width: 6%;">
                            <col style="width: 20%;">
                            <col style="width: 8%;">
                            <col style="width: 8%;">
                            <col style="width: 8%;">
                            <col style="width: 10%;">
                            <col style="width: 10%;">
                            <col style="width: 15%;">
                            <col style="width: 10%;">
                            <col style="width: 5%;">
                        </colgroup>
                        <thead>
                        <tr class="text-center">
                            <th>序号</th>
                            <th>计划说明</th>
                            <th>需要支持</th>
                            <th>预计工时</th>
                            <th>实际工时</th>
                            <th>预计完成</th>
                            <th>实际完成</th>
                            <th>进度</th>
                            <th>状态</th>
                            <th class="text-info">操作</th>
                        </tr>
                        </thead>
                        <tbody align="center" id="tbody">
                        <tr th:each="cur : ${details != null ? details : {}}">
                            <td>
                                <input type="hidden" name="id" th:value="${cur.id}">
                                <input type="number" class="form-control input-sm" min="1" max="100"
                                       name="sequenceNumber"
                                       th:value="${cur.sequenceNumber}"
                                       placeholder="序号" autocomplete="off"/>
                            </td>

                            <td>
                            <textarea class="form-control" name="description" data-rule-required="true"
                                      th:text="${cur.description}"
                                      placeholder="计划描述" autocomplete="off" rows="3"></textarea>
                            </td>
                            <td>
                                <select class="form-control input-sm" name="needsSupport" th:value="${cur.needsSupport}"
                                        th:attr="data-value=${cur.needsSupport}"
                                        data-rule-required="true">
                                    <option value="false">否</option>
                                    <option value="true">是</option>

                                </select>
                            </td>
                            <td>
                                <input type="number" class="form-control input-sm" name="estimatedEffort" step="any"
                                       th:value="${cur.estimatedEffort}"
                                       placeholder="预计工时" autocomplete="off"/>
                            </td>
                            <td>
                                <input type="number" class="form-control input-sm" name="actualEffort" step="any"
                                       th:value="${cur.actualEffort}"
                                       placeholder="实际工时" autocomplete="off"/>
                            </td>
                            <td>
                                <input class="datetime form-control input-sm" name="plannedCompletionDate" type="text"
                                       th:value="${#dates.format(cur.plannedCompletionDate, 'yyyy-MM-dd')}"
                                       data-date-format="yyyy-mm-dd" data-min-view="2"
                                       readonly placeholder="日期"/>
                            </td>
                            <td>
                                <input class="datetime form-control input-sm" name="actualCompletionDate" type="text"
                                       th:value="${#dates.format(cur.actualCompletionDate, 'yyyy-MM-dd')}"
                                       data-date-format="yyyy-mm-dd" data-min-view="2"
                                       readonly placeholder="日期"/>
                            </td>
                            <td>
                                <div class="range-container">
                                    <input type="range" class="range-input" name="progress" min="0" max="100"
                                           th:value="${cur.progress}">
                                    <span id="rangeValue" class="range-value" th:text="${cur.progress}"></span>
                                </div>
                            </td>
                            <td>
                                <select class="form-control " name="status" th:value="${cur.status}"
                                        th:attr="data-value=${cur.status}"
                                        data-rule-required="true">
                                    <option th:each="item:${statusList}" th:value="${item.name()}"
                                            th:text="${item.text}"></option>
                                </select>
                            </td>
                            <td class="text-info">
                                <button class="btn btn-xs btn-danger" type="button"
                                        onclick="delRowDetail(this)"
                                        data-toggle="tooltip"
                                        title="删除">
                                    <i class="glyphicon glyphicon-trash"></i>
                                </button>
                            </td>
                        </tr>
                        <!-- </c:forEach> -->
                        </tbody>
                    </table>
                </div>


                <div class="form-group clearfix">
                    <div class="col-sm-offset-4 col-sm-8">
                        <button th:if="${remind == null}" type="button" onclick="submitBatch(this,false);"
                                class="btn btn-sm btn-primary">
                            <i class="glyphicon glyphicon-save"></i> 保存
                        </button>
                        <button th:if="${remind == null}" type="button" onclick="submitBatch(this, true);"
                                class="btn btn-sm btn-warning">
                            <i class="glyphicon glyphicon-ok"></i> 提交
                        </button>
                        <a type="button" class="btn btn-sm  btn-info" id="backBtn" th:href="@{/plan/}">
                            <i class="glyphicon glyphicon-repeat"></i> 返回
                        </a>
                    </div>
                </div>


            </form>

        </div>


    </div>
</div>
<table style="display: none;">
    <tr id="templateTr">
        <td>
            <input type="number" class="form-control input-sm" min="1" max="100" name="sequenceNumber"
                   placeholder="序号" autocomplete="off"/>
        </td>

        <td>
                            <textarea class="form-control" name="description" data-rule-required="true"
                                      placeholder="计划描述" autocomplete="off" rows="3"></textarea>
        </td>
        <td>
            <select class="form-control input-sm" name="needsSupport"
                    style="max-width: 15em;"
                    data-rule-required="true">
                <option value="false">否</option>
                <option value="true">是</option>

            </select>
        </td>
        <td>
            <input type="number" class="form-control input-sm" name="estimatedEffort" step="any" value="0"
                   placeholder="预计工时" autocomplete="off"/>
        </td>
        <td>
            <input type="number" class="form-control" name="actualEffort" step="any" value="0"
                   placeholder="实际工时" autocomplete="off"/>
        </td>
        <td>
            <!--th:value="${today}"-->
            <input class="datetime form-control input-sm" name="plannedCompletionDate" type="text"

                   data-date-format="yyyy-mm-dd" data-min-view="2"
                   readonly placeholder="日期"/>
        </td>
        <td>
            <!--th:value="${today}"-->
            <input class="datetime form-control input-sm" name="actualCompletionDate" type="text"

                   data-date-format="yyyy-mm-dd" data-min-view="2"
                   readonly placeholder="日期"/>
        </td>
        <td>
            <div class="range-container">
                <input type="range" class="range-input" name="progress" min="0" max="100" value="0">
                <span class="range-value">0</span>
            </div>

        </td>
        <td>
            <select class="form-control input-sm" name="status" data-value="" value=""
                    data-rule-required="true">
                <option th:each="item:${statusList}" th:value="${item.name()}"
                        th:text="${item.text}"></option>
            </select>
        </td>
        <td class="text-info">
            <button class="btn btn-xs btn-danger" type="button"
                    onclick="delRowDetail(this)"
                    data-toggle="tooltip"
                    title="删除">
                <i class="glyphicon glyphicon-trash"></i>
            </button>
        </td>
    </tr>
</table>

<!-- 引入通用js-->
<div th:replace="common/footer :: footer"></div>
<script th:src="@{/js/plan/plan.js}"></script>
<script>
    function checkForm(form) {

        return true;
    };


</script>

</body>
</html>